/**
 *
 * @properties={typeid:24,uuid:"5e889a0c-36e1-4f7b-91a3-e9ae654e01ce"}
 */
function clicForm()
{
	elements.tree.selectionPath = null
	if (globals.gEstadoAbm == 0)
	{
		globals.gFormSelec = arguments [0]
		
		//Lo abro en una ventana
		if (gformselec_to_forms.ventana == 1)
		{
			forms[gformselec_to_forms.nombre].controller.show(gformselec_to_forms.nombre,false)
			return
		}
		var cuenta = arguments[1]
		if (cuenta != '1')
		{
			globals.gHistoriaIndice++
			globals.ar[globals.gHistoriaIndice] = globals.gFormSelec
		}
		globals.gIdFormActual = globals.gFormSelec
		if (forms.main.elements.tabs_form.removeAllTabs())
		{
			forms.main.elements.tabs_form.addTab( forms[gidformactual_to_forms.nombre],  gidformactual_to_forms.nombre,  gidformactual_to_forms.texto,  gidformactual_to_forms.tooltip)
			globals.config()
		}
	}
	else
	{
		globals.gDialog('Aviso','Debe completar la operacion antes de salir','OK','CerrarForm')
	}
}

/**
 *
 * @properties={typeid:24,uuid:"6734aeb5-3ca9-4167-98b6-2163b16f3fe0"}
 * @AllowToRunInFind
 */
function onLoad()
{
	forms.tree.controller.find()
	id_solucion = globals.gIdSolucion
	forms.tree.controller.search()
	
	var bind1 =	forms.tree.elements.tree.createBinding( controller.getServerName(),  'soluciones')
	
	bind1.setTextDataprovider('texto')
	//bind1.setImageMediaDataprovider('imagen_ppio')
	bind1.setNRelationName('soluciones_to_grupostree')
	bind1.setChildSortDataprovider('orden')	
	
	var bind2 = forms.tree.elements.tree.createBinding( controller.getServerName(),  'grupostree')
	bind2.setTextDataprovider('descripcion')
	bind2.setNRelationName('grupostree_to_pantallas')
	bind2.setChildSortDataprovider('orden')
	
	var bind3 = forms.tree.elements.tree.createBinding( controller.getServerName(),  'pantallas')
	bind3.setTextDataprovider('texto')
	bind3.setToolTipTextDataprovider('tooltip')
	bind3.setImageMediaDataprovider('icono')	
	bind3.setMethodToCallOnClick(clicForm,'id_form')
	//bind3.setMRelationName('pantallas_to_pantallas')
	
	forms.tree.elements.tree.addRoots(forms.tree.foundset)
}
